//
//  AppDelegate.swift
//  SinaWeiBo
//
//  Created by 刘幼寒 on 5/11/16.
//  Copyright © 2016 刘幼寒. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        //设置导航栏的皮肤..越早设置越好
//        let bar = UINavigationBar.appearance()
//        bar.tintColor = UIColor.orangeColor()
        setupAppearance()
        
        
        
        //创建UIwindow
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        let tabBarVC = CZMainTabBarController()
//        tabBarVC.view.backgroundColor = UIColor.redColor()
        
        
        
//        //首页
//        let homeVC = CZHomeViewController()
//        homeVC.title = "首页"//不仅会在tabBar上面显示，还会在导航栏上显示
////        homeVC.tabBarItem.title = "首页"//只会显示在tabBar上面
//        homeVC.tabBarItem.image = UIImage(named: "tabbar_home")
//        homeVC.tabBarItem.selectedImage = UIImage(named: "tabbar_home_selected")
//        //包装导航控制器
////        let navigationController = UINavigationController(rootViewController: homeVC)
//        tabBarVC.addChildViewController(UINavigationController(rootViewController: homeVC))
//        
//        //消息
//        let messageVC = CZMessageViewController()
//        messageVC.title = "消息"
//        messageVC.tabBarItem.image = UIImage(named: "tabbar_message_center")
//        messageVC.tabBarItem.selectedImage = UIImage(named: "tabbar_message_center_selected")
//        tabBarVC.addChildViewController(UINavigationController(rootViewController: messageVC))
//        
//        //发现
//        let discoverVC = CZDiscoverViewController()
//        discoverVC.title = "发现"
//        discoverVC.tabBarItem.image = UIImage(named: "tabbar_discover")
//        discoverVC.tabBarItem.image = UIImage(named: "tabbar_discover_selected")
//        tabBarVC.addChildViewController(UINavigationController(rootViewController: discoverVC))
//        
//        //我
//        let profileVC = CZProfileViewController()
//        profileVC.title = "我"
//        profileVC.tabBarItem.image = UIImage(named: "tabbar_profile")
//        profileVC.tabBarItem.selectedImage = UIImage(named: "tabbar_profile_selected")
//        tabBarVC.addChildViewController(UINavigationController(rootViewController: profileVC))
        
        //为了测试自定义的输出格式用
//        CZprint("1", line: 2, function: "3", items: 4)
//        CZprint("1", items: 1)
//        CZprint(items: 123)
        
        //设置root控制器
//        window?.rootViewController = tabBarVC
        //设置一个临时测试用的跟控制器
        window?.rootViewController = CZWelcomeViewController()
        
        
        //设置为主窗口
        window?.makeKeyAndVisible()
        
        let userAccount = CZUserAccountViewModel.sharedInstance.userAccount
        CZprint(items: "\(userAccount)")
        
        return true
    }
    
    /**
    *  设置导航栏的皮肤，，私有方法
    */
    private func setupAppearance()
    {
        let bar = UINavigationBar.appearance()
        bar.tintColor = UIColor.orangeColor()
    }

}

